<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::group([
    'prefix' => '',
], function () {
    Route::get('/common/ys_xieyi', 'CommonController@ys_xieyi')->name('common.ys_xieyi');
    Route::get('/common/reg_xieyi', 'CommonController@reg_xieyi')->name('common.reg_xieyi');
    Route::post('/common/uploadImage', 'CommonController@uploadImage')->name('common.uploadImage');
    Route::post('/common/ocr', 'CommonController@ocr')->name('common.ocr');
    Route::post('/login', 'LoginController@login')->name('login');
    Route::post('/mpLogin', 'WechatController@mpLogin')->name('mpLogin');
    Route::get('/get_verify_code', 'LoginController@getVerifyCode')->name('get_verify_code');
    Route::get('/refresh_token', 'LoginController@refreshToken')->name('refresh_token');

    Route::get('/test/index', 'TestController@index')->name('test.index');

    Route::post('/order/unify', 'OrderController@unify')->name('order.unify');
    Route::post('/order/refundByOutTradeNo', 'OrderController@refundByOutTradeNo')->name('order.refundByOutTradeNo');
    Route::get('/escort/choose', 'EscortController@choose')->name('escort.choose');
    Route::group(['middleware'=>'api.auth'], function () {
        Route::get('/userInfo', 'UserController@userInfo')->name('userInfo');
        Route::post('/bindMobile', 'LoginController@bindMobile')->name('bindMobile');
        Route::get('/addresses', 'UserController@userAddress')->name('userAddress');
        Route::post('/bindShop', 'UserController@bindShop')->name('bindShop');
        Route::post('/unbindShop', 'UserController@unbindShop')->name('unbindShop');
        Route::get('/userShop', 'UserController@userShops')->name('userShop');
        Route::get('/shopList', 'UserController@shopList')->name('shopList');
        Route::get('/menus', 'UserController@myMenu')->name('myMenu');
        Route::get('/account', 'UserController@userAccount')->name('account');

        Route::get('/common/schools', 'CommonController@schools')->name('common.schools');
        Route::post('/common/report', 'CommonController@report')->name('common.report');

        Route::post('/order/create', 'OrderController@createOrder')->name('order_create');
        Route::get('/order/payPrice', 'OrderController@getPayPrice')->name('order_pay_price');
        Route::post('/order/payTicket', 'OrderController@payTicket')->name('pay_ticket');
        Route::get('/order/orderDetail', 'UserController@orderDetail')->name('order_detail');
        Route::get('/order/ticketInfo', 'OrderController@ticketInfo')->name('ticket_info');

        Route::get('/otherOrder', 'UserController@otherOrder')->name('other_order');
        Route::get('/myOrders', 'UserController@myOrders')->name('my_order');

        Route::post('/escort/apply', 'EscortController@apply')->name('escort.apply');
        Route::get('/escort/orderHall', 'EscortController@orderHall')->name('escort.order_hall');
//        Route::get('/escort/choose', 'EscortController@choose')->name('escort.choose');
        Route::get('/escort/changeState', 'EscortController@changeState')->name('escort.changeState');
        Route::get('/escort/myTask', 'EscortController@myTask')->name('escort.myTask');
        Route::post('/escort/receive', 'EscortController@receive')->name('escort.receive');
        Route::post('/escort/delivery', 'EscortController@delivery')->name('escort.delivery');

        Route::post('/credit/recharge', 'CreditController@rechargeBalance')->name('credit.rechargeBalance');
        Route::get('/credit/bill', 'CreditController@bill')->name('credit.bill');
        Route::post('/credit/extract', 'CreditController@extractBalance')->name('credit.extractBalance');
    });
});
